#ifndef TRACKPLAYER_H
#define TRACKPLAYER_H
#include<phonon>
class ControlWidget;

class TrackPlayer:public QObject
{
    Q_OBJECT
public:
    friend class ControlWidget;
    explicit TrackPlayer(QObject* parent=0);
    Phonon::MediaObject* getMediaObject();
    Phonon::AudioOutput* getAudioOutput();
    QString currentTackName();
    Phonon::State state();
public slots:
    void enqueue(const QString &fileName);
    void playTrack(const QString &fileName);
    void stop();
    void playOrPause(bool);
private slots:
//    void onStatedChanged(Phonon::State newState,Phonon::State oldState);
signals:
    void nextTrack();
    void currentTrack();
private:
    void creatConnections();
    Phonon::AudioOutput *audioOutput;
    Phonon::MediaObject *mediaObject;
    Phonon::MediaSource *mediaSource;
};
#endif // TRACKPLAYER_H
